package com.gorkr.daily_write;

import org.junit.jupiter.api.Test;

/**
 * @author gorkr
 * @date 2022/06/08 10:31
 **/
public class E1037ValidBoomerang {
//    public boolean isBoomerang(int[][] points) {
//
//        // 判断是否相同
//        if (points[0][0] == points[1][0]) {
//            if (points[0][1] == points[1][1]) {
//                return false;
//            }
//            if (points[2][0] == points[0][0]) {
//                return false;
//            }
//
//        } else if (points[0][1] == points[1][1]) {
//            if(points[2][1] == points[0][1]){
//                return false;
//            }
//        } else if (points[1][0] == points[2][0]) {
//            if(points[1][1]== points[2][1]){
//                return false;
//            }
//
//        }
//
//        // 判断是否在一条直线上
//        double k = (points[0][1] - points[1][1] + 0.0) / (points[0][0] - points[1][0] + 0.0);
//        double m = (points[1][1] - points[2][1] + 0.0) / (points[1][0] - points[2][0] + 0.0);
//        return !(Math.abs(k-m)<0.00000001);
//    }

    public boolean isBoomerang(int[][] points) {
        int x1 = points[0][0], y1 = points[0][1];
        int x2 = points[1][0], y2 = points[1][1];
        int x3 = points[2][0], y3 = points[2][1];
        return (y2 - y1) * (x3 - x2) != (y3 - y2) * (x2 - x1);
    }

    @Test
    public void test(){
        int[][] points = {{1,1},{1,1},{3,1}};
//        int[][] points = {{0,0},{0,1},{0,2}};
        System.out.println(isBoomerang(points));

    }
}
    